0 JBC
↳1 JBC2FIG (⇒)
↳2 JBCTerminationGraph
↳3 FIGtoITRSProof (⇒)
↳4 IDP
↳5 IDPtoQDPProof (⇒)
↳6 QDP
↳7 UsableRulesProof (⇔)
↳8 QDP
↳9 QReductionProof (⇔)
↳10 QDP
↳11 QDPOrderProof (⇔)
↳12 QDP
↳13 DependencyGraphProof (⇔)
↳14 TRUE
public class GCD5 {
public static int gcd(int a, int b) {
int tmp;
while(b > 0 && a > 0) {
tmp = b;
b = a % b;
a = tmp;
}
return a;
}
public static void main(String[] args) {
Random.args = args;
int x = Random.random();
int y = Random.random();
gcd(x, y);
}
}
public class Random {
static String[] args;
static int index = 0;
public static int random() {
String string = args[index];
index++;
return string.length();
}
}
Generated 16 rules for P and 8 rules for R.
Combined rules. Obtained 1 rules for P and 1 rules for R.
Filtered ground terms:
886_0_gcd_LE(x1, x2, x3, x4) → 886_0_gcd_LE(x2, x3, x4)
901_0_main_Return(x1) → 901_0_main_Return
Filtered duplicate args:
886_0_gcd_LE(x1, x2, x3) → 886_0_gcd_LE(x1, x3)
Combined rules. Obtained 1 rules for P and 1 rules for R.
Finished conversion. Obtained 1 rules for P and 1 rules for R. System has predefined symbols.
!= | ~ | Neq: (Integer, Integer) -> Boolean |
* | ~ | Mul: (Integer, Integer) -> Integer |
>= | ~ | Ge: (Integer, Integer) -> Boolean |
-1 | ~ | UnaryMinus: (Integer) -> Integer |
| | ~ | Bwor: (Integer, Integer) -> Integer |
/ | ~ | Div: (Integer, Integer) -> Integer |
= | ~ | Eq: (Integer, Integer) -> Boolean |
~ | Bwxor: (Integer, Integer) -> Integer | |
|| | ~ | Lor: (Boolean, Boolean) -> Boolean |
! | ~ | Lnot: (Boolean) -> Boolean |
< | ~ | Lt: (Integer, Integer) -> Boolean |
- | ~ | Sub: (Integer, Integer) -> Integer |
<= | ~ | Le: (Integer, Integer) -> Boolean |
> | ~ | Gt: (Integer, Integer) -> Boolean |
~ | ~ | Bwnot: (Integer) -> Integer |
% | ~ | Mod: (Integer, Integer) -> Integer |
& | ~ | Bwand: (Integer, Integer) -> Integer |
+ | ~ | Add: (Integer, Integer) -> Integer |
&& | ~ | Land: (Boolean, Boolean) -> Boolean |
Boolean, Integer
(0) -> (1), if ((x1[0] > 0 && x0[0] > 0 →* TRUE)∧(886_0_gcd_LE(x0[0], x1[0]) →* 886_0_gcd_LE(x0[1], x1[1])))
(1) -> (0), if ((886_0_gcd_LE(x1[1], x0[1] % x1[1]) →* 886_0_gcd_LE(x0[0], x1[0])))
886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))
COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))
886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01))) → 901_0_main_Return
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true
greater_int(pos(01), pos(01)) → false
greater_int(pos(01), neg(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(neg(01), neg(01)) → false
greater_int(pos(01), pos(s(y))) → false
greater_int(neg(01), pos(s(y))) → false
greater_int(pos(01), neg(s(y))) → true
greater_int(neg(01), neg(s(y))) → true
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
greater_int(pos(s(x)), neg(01)) → true
greater_int(neg(s(x)), neg(01)) → false
greater_int(pos(s(x)), neg(s(y))) → true
greater_int(neg(s(x)), pos(s(y))) → false
greater_int(pos(s(x)), pos(s(y))) → greater_int(pos(x), pos(y))
greater_int(neg(s(x)), neg(s(y))) → greater_int(neg(x), neg(y))
mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
if(true, x, y) → x
if(false, x, y) → y
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)
886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01)))
and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))
886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))
COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))
mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)
greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true
886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01)))
and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))
886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01)))
886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))
COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))
mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)
greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true
and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))
The following pairs can be oriented strictly and are deleted.
The remaining pairs can at least be oriented weakly.
COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))
POL(01) = 0
POL(886_0_gcd_LE(x1, x2)) = x2
POL(886_1_MAIN_INVOKEMETHOD(x1)) = x1
POL(COND_886_1_MAIN_INVOKEMETHOD(x1, x2)) = x1
POL(and(x1, x2)) = x1
POL(false) = 0
POL(greater_int(x1, x2)) = x1
POL(greatereq_int(x1, x2)) = 0
POL(if(x1, x2, x3)) = 0
POL(minus_nat_s(x1, x2)) = x1
POL(mod_int(x1, x2)) = 0
POL(mod_nat(x1, x2)) = 0
POL(neg(x1)) = 0
POL(pos(x1)) = x1
POL(s(x1)) = 1 + x1
POL(true) = 1
greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true
mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))
mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)
greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true
and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))